.class public Lroboguice/inject/ContextScope;
.super Ljava/lang/Object;
.source "ContextScope.java"

# interfaces
.implements Lcom/google/inject/Scope;


# instance fields
.field protected a:Ljava/util/WeakHashMap;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/WeakHashMap",
            "<",
            "Landroid/content/Context;",
            "Ljava/util/Map",
            "<",
            "Lcom/google/inject/Key",
            "<*>;",
            "Ljava/lang/Object;",
            ">;>;"
        }
    .end annotation
.end field

.field protected b:Ljava/lang/ThreadLocal;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/lang/ThreadLocal",
            "<",
            "Lroboguice/inject/ContextScope$WeakActiveStack",
            "<",
            "Landroid/content/Context;",
            ">;>;"
        }
    .end annotation
.end field

.field protected c:Ljava/util/ArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/ArrayList",
            "<",
            "Lroboguice/inject/ViewMembersInjector",
            "<*>;>;"
        }
    .end annotation
.end field

.field protected d:Ljava/util/ArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/ArrayList",
            "<",
            "Lroboguice/inject/PreferenceMembersInjector",
            "<*>;>;"
        }
    .end annotation
.end field


# direct methods
.method public constructor <init>(Lroboguice/application/RoboApplication;)V
    .locals 1
    .parameter

    .prologue
    .line 79
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 74
    new-instance v0, Ljava/util/WeakHashMap;

    invoke-direct {v0}, Ljava/util/WeakHashMap;-><init>()V

    iput-object v0, p0, Lroboguice/inject/ContextScope;->a:Ljava/util/WeakHashMap;

    .line 75
    new-instance v0, Ljava/lang/ThreadLocal;

    invoke-direct {v0}, Ljava/lang/ThreadLocal;-><init>()V

    iput-object v0, p0, Lroboguice/inject/ContextScope;->b:Ljava/lang/ThreadLocal;

    .line 76
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Lroboguice/inject/ContextScope;->c:Ljava/util/ArrayList;

    .line 77
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Lroboguice/inject/ContextScope;->d:Ljava/util/ArrayList;

    .line 80
    invoke-virtual {p0, p1}, Lroboguice/inject/ContextScope;->a(Landroid/content/Context;)V

    .line 81
    return-void
.end method


# virtual methods
.method protected a(Lcom/google/inject/Key;)Ljava/util/Map;
    .locals 3
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "<T:",
            "Ljava/lang/Object;",
            ">(",
            "Lcom/google/inject/Key",
            "<TT;>;)",
            "Ljava/util/Map",
            "<",
            "Lcom/google/inject/Key",
            "<*>;",
            "Ljava/lang/Object;",
            ">;"
        }
    .end annotation

    .prologue
    .line 156
    iget-object v0, p0, Lroboguice/inject/ContextScope;->b:Ljava/lang/ThreadLocal;

    invoke-virtual {v0}, Ljava/lang/ThreadLocal;->get()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lroboguice/inject/ContextScope$WeakActiveStack;

    invoke-virtual {v0}, Lroboguice/inject/ContextScope$WeakActiveStack;->a()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/content/Context;

    .line 158
    iget-object v1, p0, Lroboguice/inject/ContextScope;->a:Ljava/util/WeakHashMap;

    invoke-virtual {v1, v0}, Ljava/util/WeakHashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Ljava/util/Map;

    .line 159
    if-nez v1, :cond_0

    .line 160
    invoke-static {}, Lcom/google/inject/internal/Maps;->newHashMap()Ljava/util/HashMap;

    move-result-object v1

    .line 161
    iget-object v2, p0, Lroboguice/inject/ContextScope;->a:Ljava/util/WeakHashMap;

    invoke-virtual {v2, v0, v1}, Ljava/util/WeakHashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    move-object v0, v1

    .line 164
    :goto_0
    return-object v0

    :cond_0
    move-object v0, v1

    goto :goto_0
.end method

.method public a()V
    .locals 2

    .prologue
    .line 92
    iget-object v0, p0, Lroboguice/inject/ContextScope;->c:Ljava/util/ArrayList;

    invoke-virtual {v0}, Ljava/util/ArrayList;->size()I

    move-result v0

    const/4 v1, 0x1

    sub-int/2addr v0, v1

    move v1, v0

    :goto_0
    if-ltz v1, :cond_0

    .line 93
    iget-object v0, p0, Lroboguice/inject/ContextScope;->c:Ljava/util/ArrayList;

    invoke-virtual {v0, v1}, Ljava/util/ArrayList;->remove(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lroboguice/inject/ViewMembersInjector;

    invoke-virtual {v0}, Lroboguice/inject/ViewMembersInjector;->a()V

    .line 92
    add-int/lit8 v0, v1, -0x1

    move v1, v0

    goto :goto_0

    .line 94
    :cond_0
    return-void
.end method

.method public a(Landroid/content/Context;)V
    .locals 5
    .parameter

    .prologue
    .line 103
    invoke-virtual {p0}, Lroboguice/inject/ContextScope;->c()V

    .line 104
    iget-object v0, p0, Lroboguice/inject/ContextScope;->b:Ljava/lang/ThreadLocal;

    invoke-virtual {v0}, Ljava/lang/ThreadLocal;->get()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lroboguice/inject/ContextScope$WeakActiveStack;

    invoke-virtual {v0, p1}, Lroboguice/inject/ContextScope$WeakActiveStack;->a(Ljava/lang/Object;)V

    .line 106
    const-class v0, Landroid/content/Context;

    invoke-static {v0}, Lcom/google/inject/Key;->get(Ljava/lang/Class;)Lcom/google/inject/Key;

    move-result-object v0

    .line 107
    invoke-virtual {p0, v0}, Lroboguice/inject/ContextScope;->a(Lcom/google/inject/Key;)Ljava/util/Map;

    move-result-object v1

    invoke-interface {v1, v0, p1}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 109
    invoke-static {}, Lroboguice/util/Ln;->a()Z

    move-result v0

    if-eqz v0, :cond_0

    .line 110
    iget-object v0, p0, Lroboguice/inject/ContextScope;->a:Ljava/util/WeakHashMap;

    .line 111
    if-eqz v0, :cond_0

    .line 112
    const-string v1, "Contexts in the %s scope map after inserting %s: %s"

    const/4 v2, 0x3

    new-array v2, v2, [Ljava/lang/Object;

    const/4 v3, 0x0

    invoke-static {}, Ljava/lang/Thread;->currentThread()Ljava/lang/Thread;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/Thread;->getName()Ljava/lang/String;

    move-result-object v4

    aput-object v4, v2, v3

    const/4 v3, 0x1

    aput-object p1, v2, v3

    const/4 v3, 0x2

    const-string v4, ", "

    invoke-virtual {v0}, Ljava/util/WeakHashMap;->keySet()Ljava/util/Set;

    move-result-object v0

    invoke-static {v4, v0}, Lroboguice/util/Strings;->a(Ljava/lang/String;Ljava/util/Collection;)Ljava/lang/String;

    move-result-object v0

    aput-object v0, v2, v3

    invoke-static {v1, v2}, Lroboguice/util/Ln;->a(Ljava/lang/Object;[Ljava/lang/Object;)I

    .line 114
    :cond_0
    return-void
.end method

.method public a(Lroboguice/inject/PreferenceMembersInjector;)V
    .locals 1
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Lroboguice/inject/PreferenceMembersInjector",
            "<*>;)V"
        }
    .end annotation

    .prologue
    .line 88
    iget-object v0, p0, Lroboguice/inject/ContextScope;->d:Ljava/util/ArrayList;

    invoke-virtual {v0, p1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 89
    return-void
.end method

.method public a(Lroboguice/inject/ViewMembersInjector;)V
    .locals 1
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Lroboguice/inject/ViewMembersInjector",
            "<*>;)V"
        }
    .end annotation

    .prologue
    .line 84
    iget-object v0, p0, Lroboguice/inject/ContextScope;->c:Ljava/util/ArrayList;

    invoke-virtual {v0, p1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 85
    return-void
.end method

.method public b()V
    .locals 2

    .prologue
    .line 97
    iget-object v0, p0, Lroboguice/inject/ContextScope;->d:Ljava/util/ArrayList;

    invoke-virtual {v0}, Ljava/util/ArrayList;->size()I

    move-result v0

    const/4 v1, 0x1

    sub-int/2addr v0, v1

    move v1, v0

    :goto_0
    if-ltz v1, :cond_0

    .line 98
    iget-object v0, p0, Lroboguice/inject/ContextScope;->d:Ljava/util/ArrayList;

    invoke-virtual {v0, v1}, Ljava/util/ArrayList;->remove(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lroboguice/inject/PreferenceMembersInjector;

    invoke-virtual {v0}, Lroboguice/inject/PreferenceMembersInjector;->a()V

    .line 97
    add-int/lit8 v0, v1, -0x1

    move v1, v0

    goto :goto_0

    .line 99
    :cond_0
    return-void
.end method

.method public b(Landroid/content/Context;)V
    .locals 1
    .parameter

    .prologue
    .line 117
    invoke-virtual {p0}, Lroboguice/inject/ContextScope;->c()V

    .line 118
    iget-object v0, p0, Lroboguice/inject/ContextScope;->b:Ljava/lang/ThreadLocal;

    invoke-virtual {v0}, Ljava/lang/ThreadLocal;->get()Ljava/lang/Object;

    move-result-object p0

    check-cast p0, Lroboguice/inject/ContextScope$WeakActiveStack;

    invoke-virtual {p0, p1}, Lroboguice/inject/ContextScope$WeakActiveStack;->b(Ljava/lang/Object;)V

    .line 119
    return-void
.end method

.method protected c()V
    .locals 2

    .prologue
    .line 150
    iget-object v0, p0, Lroboguice/inject/ContextScope;->b:Ljava/lang/ThreadLocal;

    invoke-virtual {v0}, Ljava/lang/ThreadLocal;->get()Ljava/lang/Object;

    move-result-object v0

    if-nez v0, :cond_0

    .line 151
    iget-object v0, p0, Lroboguice/inject/ContextScope;->b:Ljava/lang/ThreadLocal;

    new-instance v1, Lroboguice/inject/ContextScope$WeakActiveStack;

    invoke-direct {v1}, Lroboguice/inject/ContextScope$WeakActiveStack;-><init>()V

    invoke-virtual {v0, v1}, Ljava/lang/ThreadLocal;->set(Ljava/lang/Object;)V

    .line 153
    :cond_0
    return-void
.end method

.method public c(Landroid/content/Context;)V
    .locals 5
    .parameter

    .prologue
    .line 122
    iget-object v0, p0, Lroboguice/inject/ContextScope;->a:Ljava/util/WeakHashMap;

    .line 123
    if-eqz v0, :cond_1

    .line 124
    invoke-virtual {v0, p1}, Ljava/util/WeakHashMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object p0

    check-cast p0, Ljava/util/Map;

    .line 125
    if-eqz p0, :cond_0

    .line 126
    invoke-interface {p0}, Ljava/util/Map;->clear()V

    .line 128
    :cond_0
    invoke-static {}, Lroboguice/util/Ln;->a()Z

    move-result v1

    if-eqz v1, :cond_1

    .line 129
    const-string v1, "Contexts in the %s scope map after removing %s: %s"

    const/4 v2, 0x3

    new-array v2, v2, [Ljava/lang/Object;

    const/4 v3, 0x0

    invoke-static {}, Ljava/lang/Thread;->currentThread()Ljava/lang/Thread;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/Thread;->getName()Ljava/lang/String;

    move-result-object v4

    aput-object v4, v2, v3

    const/4 v3, 0x1

    aput-object p1, v2, v3

    const/4 v3, 0x2

    const-string v4, ", "

    invoke-virtual {v0}, Ljava/util/WeakHashMap;->keySet()Ljava/util/Set;

    move-result-object v0

    invoke-static {v4, v0}, Lroboguice/util/Strings;->a(Ljava/lang/String;Ljava/util/Collection;)Ljava/lang/String;

    move-result-object v0

    aput-object v0, v2, v3

    invoke-static {v1, v2}, Lroboguice/util/Ln;->a(Ljava/lang/Object;[Ljava/lang/Object;)I

    .line 131
    :cond_1
    return-void
.end method

.method public scope(Lcom/google/inject/Key;Lcom/google/inject/Provider;)Lcom/google/inject/Provider;
    .locals 1
    .parameter
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "<T:",
            "Ljava/lang/Object;",
            ">(",
            "Lcom/google/inject/Key",
            "<TT;>;",
            "Lcom/google/inject/Provider",
            "<TT;>;)",
            "Lcom/google/inject/Provider",
            "<TT;>;"
        }
    .end annotation

    .prologue
    .line 134
    new-instance v0, Lroboguice/inject/ContextScope$1;

    invoke-direct {v0, p0, p1, p2}, Lroboguice/inject/ContextScope$1;-><init>(Lroboguice/inject/ContextScope;Lcom/google/inject/Key;Lcom/google/inject/Provider;)V

    return-object v0
.end method
